function init(config) {
  return {
    getSellHistory(send) {
      const url = `${config.agentSystem}${send.areaCode}`;
      const queryObj = {
        source: {
          lftid: send.lftid,
          offset: send.offset,
          limit: send.limit || 15,
          types: send.recordType
        },
        token: send.token,
        type: 5514
        // type: send.recordType ? 5514 : 5503
      }
      console.log('queryObj', JSON.stringify(queryObj));
      const myRequest = new Request(url, {
        method: 'POST',
        body: JSON.stringify(queryObj)
      });
      return fetch(myRequest)
    },
    upgradeAgent(lftid) {
      const url = `${config.agentSystem}${Cookies.get('areaCode')}`
      const queryObj = {
        source: {
          lftid
        },
        token: Cookies.get('token'),
        type: 5515
      }
      console.log('queryObj', JSON.stringify(queryObj))
      return fetch(url, {
        method: 'POST',
        body: JSON.stringify(queryObj)
      });
    }
  }
}

export default init